package com.surfilter.es.qb;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;


public class AuthorityTypeLoad {
	private static Logger logger = LoggerFactory.getLogger(AuthorityTypeLoad.class);
	public static Map<Integer,String> authorityTypeMap;
	public static Map<Integer,String> industryType;
	public static Map<Integer,String> punishType;
	public static void initAuthority(String path){
		authorityTypeMap=new HashMap<Integer,String>();
		BufferedReader reader;
		try {
			reader = new BufferedReader(new FileReader(path));
			StringBuilder builder = new StringBuilder();
			while(true){
				String line = reader.readLine();
				if(line == null)
					break;
				if(line.contains("\t")){
					String[] aType = line.split("\t");
					authorityTypeMap.put(Integer.parseInt(aType[0]), aType[1]);
				}else
					continue;
			}
		}catch(Exception e){
			e.printStackTrace();
			logger.error(e.getMessage());
		}
	}
	public static void initIndustry(String path){
		industryType=new HashMap<Integer,String>();
		BufferedReader reader;
		try {
			reader = new BufferedReader(new FileReader(path));
			StringBuilder builder = new StringBuilder();
			while(true){
				String line = reader.readLine();
				if(line == null)
					break;
				if(line.contains("\t")){
					String[] aType = line.split("\t");
					industryType.put(Integer.parseInt(aType[0]), aType[1]);
				}else
					continue;
			}
		}catch(Exception e){
			e.printStackTrace();
			logger.error(e.getMessage());
		}
	}
	public static void initPunishType(){
		punishType=new HashMap<Integer,String>();
		punishType.put(1, "拘留,劳教,劳动教养,拘役,拘禁");
		punishType.put(2, "罚款,赔偿,赔款,缴纳,人民币");
		punishType.put(3, "暂扣,吊销,没收,撤销,注销,停产,停业,整顿,整改,查封,停止生产");
		punishType.put(4, "警告,通报,批评,教育,公布,公开");
	}
}
